Part Number Hot Search : 
10179 ACTR8008 EP2645 LB251 FOD07 240NS40 MALRE CAT25
Product Description
Full Text Search
 

To Download AT89C2051LDR Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  device usage monitor using at89c2051 s.r. jadhav, g.b.waghmare, s.s.nirmale, dr. p.a.kadam, dr. r.r.mudholkar department of electronics, shivaji university, kolhapur, maharashtra, 416004 india e - mail: pak_eln@unishivaji.ac.in abstract : manufacturers p rovide usage guidelines for critical devices in working hours. the device has been guaranteed to work within these usage limits. it is very important that the specification closely matches with the actual device performance. otherwise the device finds limi ted applicability, reliability and thus fails to meet the application prospects. the system described in this article monitors the device usage using optical sensor [1] . in this work ldr [2] has been selected as a sensor to monitor usage of the lcd monitor . these readings have been useful for comparing the performance of lcd monitor. the system has been designed around the atmel microcontroller at89c2051, the on - chip analog comparator [3] of which reduces need of external components . the 16*2 lcd display sho ws the elapsed time and total usage time. keywords: embedded systems, 8051, device usage monitor, ldr 1.1 introduction: - embedded systems are getting more and more popular with their integration in large number of applications. broadly speaking today every application has got at least one embedded component integrated inside it e.g. consumer electronics, automobiles, industrial automation, networking etc. the major benefits of using embed system improved reliability, performance, efficiency, sca lability and low cost. such systems can be found very useful in many applications where direct human intervention is not possible or at least not necessary. the manufacturers of time critical appliances specify device usage specification in hours. in actu al practice the device may fail to meet the specification provided by the manufacturer, which may severely affect the user application. hence some practical solution for this situation is required. this paper describes design of device monitoring system us ing microcontroller at89c2051, which senses the device status using ldr [2] sensor and displays the usage status on 16*2 lcd display. thus this system has been found useful for the devices which give visual indication when they are turned on. the unique adv antage of the system is that the system is totally isolated from the device to be monitored and thus it is free from any type of switching disturbances generated by the device. the system uses very few components, thanks to the on - chip analog comparator fe ature provided by at89c2051 [3] ; this provides higher reliability and usability with battery power. in this study, different devices such as display monitor, microwave oven have been monitored for their usage time. by simply tuning ldr signal conditioning system block for differing intensities the system adjusts itself with different appliances. the output of ldr has been compared to the reference voltage by on - chip analog comparator. the reference voltage decides the intensity level at which switching shou ld occur. the
microcontroller using polling mode reads the comparator output and counts accordingly using on - chip timer. the time duration has been displayed on the 16*2 lcd. 1.2 system block diagram - : the system block diagram is shown in fig. 1. it c onsists of ldr as a sensor, a microcontroller for controlling systems activities, a lcd for local real - time display of on time of display. the individual blocks are described below. fig. 1. system block diagram. the sensor unit monitors light intensity w ith t he help ldr , which has been connected in a voltage divider circuit. sensor produces linear output within the specified range of maximum and minimum light intensit ies . the output from the voltage divider has been connected to the analog comparator of the microcontroller. the port pins p1.0 and p1.1 act as a non - inverting and inverting inputs respectively and p3.6 as an output of an analog comparator. the reference level has been applied using a 10k preset to the inverting input, which varies in the ra nge of 0 - 5v. the reference level is adjusted to detect the minimum level of the incident light. when the ldr receives the light, its resistance decreases. this increases the potential at the non - inverting input of analog comparator and the c omparator switc hes the output. the microcontroller has been clocked at 12mhz for accurate time calculations using on - chip timer. the timer forms the basis of time calculations by providing ticks (interrupts) at regular intervals. the timer configuration provides 50 mse c period which has been multiplied by soft - timer to get 1 sec count. similarly the microcontroller calculates minutes and hours and displays the usage time onto the lcd display. the detailed schematic diagram of the system is shown in fig. 2 . at89c2051 sensor (ldr) regulated power supply analog comparato r timer 16*2 lcd
1.3 circui t diagram: fig. 2. schematic of system. ( ic 1) at89c2051, lcd 16*2. p3.0 p3.1 p3.2 p3.3 d4 d5 d6 d7 rs rw en p3. 4 p3.5 p3. 7
1.4 : theoretical aspect s : - 1.4 .1:microcontroller at89c2051: [3 ] the port 1 is an 8 - bit bi - directional i/o port. p1.0 and p1.1 require external pull - ups. p 1.0 and p1.1 also serve as the positive input (ain0) and the negative input (ain1), respectively, the pin p3.6 is reserved for comparator output, this pin is not available at port 3 for any external application, and only available inernally. when 1 is wri tten to port 1 pins, they can be u sed as inputs . the comparator action is shown in fig. 3. fig. 3 internal comparator of ic 89c2051. 1.4 .2 sensor : light dependent resistor C ldr [2] two cadmium sulphide(cds) photoconductive cells with spectral responses similar to that of the human eye. the cell resistance falls with increasing light intensity. ldr specifications - : operating temperature - 60 - +75 deg. c. power dissipation 100 mw max. maximum current - - 75 ma max. maximum voltage appli ed ac/dc peak - - 320 v max. dark resistance - - 1 - m ohm. light resistance C 1 ohm. dark capacitance - - 3.5 C pf. it has high sensitivity. a photo resistor is a sensor whose resistance varies with light intensity. most decrease in resistance as the li ght intensity increases. in a typical microcontroller
application, this resistance must be converted to a voltage so that an a - d converter can measure it. the easiest way to do this is with a voltage divider circuit. a voltage divider is just two resisto rs in series connected between a voltage supply and ground as shown in fig 4 . if r1 is connected to the voltage supply and r2 is connected to ground then the voltage at the junction between the two resistors is: if r1 is the photo resistor, the voltage will increase with increasing light intensity. if r2 is the photo resistor, the voltage will decrease with increasing light intensity. [2] fig 4 . ldr connections : 1.5 : software description: - on power - up the initialization part of the system software con figures various on chip peripherals such as timers, interrupts, lcd, comparator etc. and polls for the sensor output. the flowchart of the software has been shown in fig 5 and program code has been given in the listing 1. the microcontroller starts countin g when it reads comparator output as low.[4] for real time processing the timer - 0 of at89c2051 has been used. it has been configured in 16 bit timer mode, timer high(th0) and low(tl0) counts are loaded for providing 50msec delay; which multiplied by 20, in timer isr, gives accurate 1 sec delay. the timer isr further multiplies the 1 sec delay to get minutes, hours. the 16*2 lcd display shows time in the hh:mm:ss format . the counting proceeds until the device to be monitored is on. when the device turne d off, the ldr receives less light (ambient light if not properly shielded). this increases resistance of ldr and lowers potential at the non - inverting input of analog comparator. the comparator again toggles the output, turning off the timer. microcontrol ler then displays the time elapsed. table 1 gives lcd control signals and commands used in the program. table 2 gives program structure and table 3 shows port configurations.
fig. 5. software flow
1.5. 1 real time clock calculations: the timer 0 of at89c2051 has been used to form time base of real time clock. it has been configured to operate in 16 bit counter mode and timer interrupt has been enabled to generate timer tick interrupt. the count to be loaded in th and tl registers has been calculated as follows. timer 0, 16 bit mode ? maximum count 65535. crystal frequency = 12mhz timer increments every machine cycle i.e. after 1 machine cycle period = 1 sec. so adjust timer count to get 50,000 sec time base. ? timer count = [th:tl ] = max. count C 50000 + 1 = 65535 C 50000 + 1 = 15536 d = 3cb0 h thus timer registers have been loaded as th0 = 3ch, tl0=b0h. the timer vector routine performs following tasks when invoked at timer tick event. 1) reload timer registers a gain for the next counting cycle, and run the timer. 2) multiply timer tick period by 20 to get 1sec clock base. 3) process clock data in the form of hh:mm:ss. the display routine in the task context displays hh:mm:ss. listing 1: device monitor prog ram routiunes /* ------------------------------------------------------------------- */ // program to find devi ce usage . /* ------------------------------------------------------------------- */ #include void lcd_init(); //funtion to initialise lcd void lcd_cmd(char cmd_value); //funtion to send commands lcd #define rs p3_ 4 #define rw p3_ 5 #define en p3_ 7 #define lcdport p3 #define busy_bit p3_3 unsigned char sec=0x00,min=0x00,hour=0x00; //initilising from zero timing unsigned char cnt=0; void lcdcmd(unsigned char a); //to send command to lcd void lcddata(unsigned char a); //to send data to lcd void timer0 (void) interrupt 1 //to calcu late 1 second delay { th0=0x3c; //load higher and lower count in timer tl0=0xb0; tr0=1; //reinitialize and run timer cnt++; if(cnt>19) //multiply 50 msec delay 20 { time to get require 1 sec delay cnt=0; se c++; //increment sec.
if(sec>59) sec=0; min++; //increment min. if(min>59) { min=0; hour++; //increment hour. } } } } /* ------------------------------------------------------------------- */ void lcd_busy(void) //funtion to check busy flag { busy_bit = 1; rs=0; rw=1; en=0; en=1; while(busy_bit) { en=0; en=1; }; en=0; } /* ------------------------------------------------------------------- */ void lcd_cmd(char cmd) / /function to send command to lcd { lcdport = (cmd>>4) & 0x0f; //to convert lcd 8 bit data into 4 bit lcd_busy(); //check busy flag rs = 0; rw = 0; en = 0; en = 1; en = 0; lcdport = cmd & 0x0f; rs = 0; rw = 0; e n = 0; en = 1; en = 0; } /* ------------------------------------------------------------------ */ void lcd_data(char cmd) //funtion to send data to lcd { lcdport = (cmd>>4) & 0x0f; // to convert lcd 8 bit data into 4 bit lcd_busy(); // check bus y flag rs = 1; rw = 0; en = 0; en = 1; en = 0;
lcdport = cmd & 0x0f; rs = 1; rw = 0; en = 0; en = 1; en = 0; } /* ------------------------------------------------------------------- */ void lcd_init() //function for initialize { lcd_cmd(0x0 2); //to initialize lcd in 4 - bit mode. lcd_cmd(0x28); //to initialize lcd in 2 lines, 5x7 dots. lcd_cmd(0x0c); and 4bit mode lcd_cmd(0x06); lcd_cmd(0x83); } /* --------------------------------------------------------------- */ void ms g1(void) { lcd_data('c'); lcd_data('o'); lcd_data('u'); lcd_data('n'); lcd_data('t'); lcd_data('i'); lcd_data('n'); lcd_data('g'); lcd_data(' '); lcd_data('t'); lcd_data('i'); lcd_data('m'); lcd_data('e'); lcd_data(':'); } /* -- ---------------------------------------------------------------- */ void main() { aout = 1; tmod=1; //timer 0 mode 1 ie=0x82; //timer0 intr enable lcd_init(); lcd_cmd(0x80); //selecting memory location 80 of lcd msg1() ; tcon=0x10; //start timer while(1) { if(aout==0) //when comparator output == 0 { tcon=0; //stop timer } lcd_cmd(0xc0); //set location of lcd lcd_data((hour/10)+0x30); //to display hour lcd_data((h our%10)+0x30); lcd_data(':'); lcd_data((min%10)+0x30); //to display min lcd_data((min%10)+0x30);
lcd_data(':'); lcd_data((sec%10)+0x30); //to display sec lcd_data((sec%10)+0x30); } } /* ---------------------------------------------------------- -------- */ table 1: lcd control signals and commands: [4 ] command function rs register select rs=0(status reg)&rs=1(data reg) rw read/write rw=0(write to display,rw=1(read from display) en enable lcd en=1(enable display interface) 0x38 16*2 lcd se lect 0x01 clear display 0x06 shift cursor to right 0x0e screen on and cursor on table 2: program structure no. function description 1 void lcdinit() lcd initialize 2 void timer 0 (void) interrupt 1 rtc processing in isr context 3 void lcdcmd () to provide commands to lcd 4 void lcddata() to provide data to lcd 5 lcd_data_int(int time_val) function to send number on lcd 6 void main() entry point table 3 : port pin configuration : [3] 1. 6 . observations: the data of output resistance of ldr is recorded for various light intensity of light source as indicated by table no 4. and resented graphically in fig. 6. intensity of light has varied by changing the voltage to the light source and respective reading for the intensity and ldr resistance has taken. sr. no. port pin no. port pin descriptions 1 p1.0 ,p 1.1,p3.6 input and output of on - chip analog comparator. 2 p3. 4,p3.5, p3. 7 control signal of lcd (en,rs,rw). 3 p 3 . 0 - p 3 . 3 data lines of lcd
table 4 : light intensity versus ldr resistan ce fig 6 .graph of resistance of ldr verses light intensity. obs. no. voltage of dimmer in v light intensity in lux resistance of ldr in ohm r1 r2 r3 mean (r) 1 40 0.1 118000 118000 117995 118000 2 60 0.5 42000 42000 42000 42000 3 80 6.7 9000 8988 9000 9000 4 90 51.3 2100 2100 20994 2100 5 100 110.5 1597 1600 1600 1600 6 110 280 1070 1070 1070 1070 7 120 460 892 895 895 895 8 130 502 475 475 477 475 9 140 850 470 475 475 475 10 150 1400 305 300 300 300 11 160 1500 270 270 270 270 12 180 1580 230 225 230 230 13 200 2100 110 100 100 100 14 210 5500 80 80 80 80 15 220 6500 50 45 45 45 ldr charactristic 0 5000 10000 15000 20000 25000 30000 35000 40000 45000 1 2 3 4 light intensity in lux resistance in ohm series1 series2
1. 7 onclusion: the data provided by device monitor has been found useful for testing truthfulness of manufacturer specifications. the system can be modi fied to accommodate eeprom to store the values for future reference. a serial/ethernet [5] link with pc can also be used for pc data logging. references 1. j. jayapandian, o.k. sheela, a. thiruarul, s. kalavathi, embedd ed design and virtual sensor interfacing, journal of the association for laboratory automation, volume 11, issue 5, october 2006,pages 304 - 308 2. photoresistor , from wikipedia, the free encyclopedia , http://en.wikipedia.org/wiki/light_dependent_resistor , wikimedia foundation, inc. (visited on 7 - jan - 2011) 3. feature and application of analog comparator, 2008 atmel corporation ltd www.pdf/pdf/56224/atmel/89c2051.html page no. 1 - 3 date:3 jan. 2011 . 4. document no. :32217 lcd command and specification http://www.futurlec.com/lcddisp.shtml 162 character lcd from page 3 to 8 date: 7 jan 2011 5. p.a.kadam et.al. instruments and experimental techniques, 2009 embedded web server for monitoring environmental parameters vol. 52, no. 6, pp. 784 C 787 , date: 11 jan 2011 issn 0020_4412


▲Up To Search▲   

 
Price & Availability of AT89C2051LDR

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X